<body>
<p>Test worker garbage collection. Should print "SUCCESS".</p>
<div id=result></div>
<script src="../../../resources/gc.js"></script>
<script>
function log(message)
{
    document.getElementById("result").innerHTML += message + "<br>";
}

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

var interval = setInterval(gc, 0);

var worker = new Worker('../resources/worker-common.js');
worker.postMessage("ping");
worker.onmessage = function(evt) {
    this.postMessage("ping");
    this.onmessage = function() {
        log("SUCCESS");
        clearInterval(interval);
        if (window.testRunner)
            testRunner.notifyDone();
    }
    
}
worker = 0;
gc();
</script>
</body>
</html>
